package com.example.entity;


import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Optional;
@TableName("sys_user")
public class SysUsr implements Serializable {
  @TableId(value = "usr_id")
  private long usrId;
  @TableField("usr_name")
  private String usrName;
  @TableField("usr_password")
  private String usrPassword;
  @TableField("usr_role_id")
  private long usrRoleId;
  @TableField("usr_flag")
  private long usrFlag;
  @TableField(exist = false)
  private SysRole role;

  public SysRole getRole() {
    return role;
  }

  public void setRole(SysRole role) {
    this.role = role;
  }

  public long getUsrId() {
    return usrId;
  }

  public void setUsrId(long usrId) {
    this.usrId = usrId;
  }


  public String getUsrName() {
    return usrName;
  }

  public void setUsrName(String usrName) {
    this.usrName = usrName;
  }


  public String getUsrPassword() {
    return usrPassword;
  }

  public void setUsrPassword(String usrPassword) {
    this.usrPassword = usrPassword;
  }


  public long getUsrRoleId() {
    return usrRoleId;
  }

  public void setUsrRoleId(long usrRoleId) {
    this.usrRoleId = usrRoleId;
  }


  public long getUsrFlag() {
    return usrFlag;
  }

  public void setUsrFlag(long usrFlag) {
    this.usrFlag = usrFlag;
  }

  public SysUsr(SysUsr sysUser) {
    Optional.ofNullable(sysUser).ifPresent(e -> {
      this.usrId = sysUser.getUsrId();
      this.usrFlag = sysUser.getUsrFlag();
      this.usrName = sysUser.getUsrName();
      this.usrPassword = sysUser.getUsrPassword();
      this.usrRoleId = sysUser.getUsrRoleId();
    });
  }

  public SysUsr() {
  }

  public SysUsr(long usrId, String usrName, String usrPassword, long usrRoleId, long usrFlag, SysRole role) {
    this.usrId = usrId;
    this.usrName = usrName;
    this.usrPassword = usrPassword;
    this.usrRoleId = usrRoleId;
    this.usrFlag = usrFlag;
    this.role = role;
  }
}
